<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>

<body>

    <div id="box">

        <select v-model="selected">
          <option value="all" >全部订单</option>
          <!-- //动态绑定，字符串会被解析为数字 ，与后面state相一致-->
          <option :value="0">未付款</option> 
          <option :value="1">已取消</option>
          <option :value="2">待发货</option>
          <option :value="3">已完成</option>
      </select>
        <ul>
            <template v-for="({title,state},index) of datalist">

          
            <li  v-if="state===selected">
                {{title}}
            </li>
<hr>
            <li v-if="selected==='all'"></li>
            {{title}}
          </template>
        </ul>


    </div>
    <script>
        var obj = {
                data() {
                    return {
                        datalist: [{
                            title: '手机-未付款订单',
                            state: 0
                        }, {
                            title: '电脑-已取消订单',
                            state: 1
                        }, {
                            title: '鼠标-待发货订单',
                            state: 2
                        }, {
                            title: '键盘-已完成订单',
                            state: 3
                        }, {
                            title: '键盘11-已完成订单',
                            state: 3
                        }, {
                            title: '手机11-未付款订单',
                            state: 0
                        }],

                        selected: 0
                    }
                },

            }
            // 创建vue实例
        var app = Vue.createApp(obj).mount('#box')
    </script>
</body>

</html>